cmake_minimum_required(VERSION 2.8.3)
project(n_lidar_obj)

## Compile as C++11, supported in ROS Kinetic and newer
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  -std=c++0x")
# set(CMAKE_CXX_STANDARD 11)
# set(CMAKE_CXX_STANDARD_REQUIRED ON)
# set(CMAKE_CXX_EXTENSIONS OFF)
add_compile_options(-std=c++11 -g)
add_definitions(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
    roscpp
    std_msgs
    tf
    #msg_obj_fuse
    sensor_msgs
    nav_msgs
    visualization_msgs
    cmake_modules REQUIRED
    message_generation
    msg_lidar_obj
    msg_lidar_shape
    msg_lidar_prep
)

find_package(OpenMP REQUIRED)
#MultiThreading Library
OPTION (USE_OpenMP "Use OpenMP" OFF)
IF(USE_OpenMP)
  FIND_PACKAGE(OpenMP)
  IF(OPENMP_FOUND)
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
  ENDIF()
ENDIF()

set(ALL_TARGET_LIBRARIES "")

# include(cmake/eigen.cmake)
include(cmake/OpenCV.cmake)
# include(cmake/OpenMP.cmake)
include(cmake/PCL.cmake)

include_directories(
  include
#  /usr/include/pcl-1.9
#  /usr/local/include/pcl-1.9
#  /home/aaa/Vas/liglog/include
#  include/log4cplus
#  ${PCL_INCLUDE_DIRS}
  ${EIGEN_INCLUDE_DIRS}
  ${catkin_INCLUDE_DIRS}
#  ${OpenCV_INCLUDE_DIRSD} # 包含opencv库的头文件
  #../../../src/liblog/include
)
include(cmake/global_defination.cmake)
catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES n_lidar_obj
#  CATKIN_DEPENDS other_catkin_pkg
#  CATKIN_DEPENDS message_runtime
#  DEPENDS system_lib
)

file(GLOB_RECURSE ALL_SRCS "*.cpp") # 把src文件夹下所有cpp文件合并到一个变量中
file(GLOB_RECURSE NODE_SRCS "src/*in.cpp")
list(REMOVE_ITEM ALL_SRCS ${NODE_SRCS}) # 当工程中有多个node文件的时候，就要把他们从这个变量中踢出去

add_executable(n_lidar_obj src/main.cpp ${ALL_SRCS})
target_link_libraries(n_lidar_obj ${catkin_LIBRARIES} ${ALL_TARGET_LIBRARIES})

# aux_source_directory(./src PROJECT_SRC)
# aux_source_directory(./src/util PROJECT_SRC_UTIL)
# aux_source_directory(./src/depth_cluster PROJECT_SRC_DEPTH_CLUSTER)
# aux_source_directory(./src/render PROJECT_SRC_RENDER)
# aux_source_directory(./src/pcl_process PROJECT_SRC_PCL_PROCESS)
# aux_source_directory(./src/bounding_box PROJECT_SRC_BOUNDING_BOX)

#aux_source_directory(./src/depth_cluster/image_labelers PROJECT_SRC_IMAGE_LABELERS)
#aux_source_directory(./src/depth_cluster/projections PROJECT_SRC_PROJECTIONS)
#aux_source_directory(./src/depth_cluster/utils PROJECT_SRC_UTILS)
#aux_source_directory(./src/depth_cluster/clusters PROJECT_SRC_CLUSTERS)
#aux_source_directory(./src/depth_cluster/communication PROJECT_SRC_COMMUNICATION)
#aux_source_directory(./src/depth_cluster/image_labelers/diff_helpers PROJECT_SRC_DIFF_HELPERS)


# PROJECT_SRC_DEPTH_CLUSTER_IMAGE_LABELERS_DIFF_HELPERS
#add_library(c_lidar_obj_util ${PROJECT_SRC_UTIL})

# link_directories(../../../src/liblog/lib/log4cplus)


# add_executable(${PROJECT_NAME} ${PROJECT_SRC} ${PROJECT_SRC_UTIL} src/depth_cluster/depth_cluster.cpp src/depth_cluster/depth_cluster.h)
# add_executable(${PROJECT_NAME} ${PROJECT_SRC}
# 		${PROJECT_SRC_UTIL}
# 		${PROJECT_SRC_DEPTH_CLUSTER}
# 		${PROJECT_SRC_RENDER}
# 		${PROJECT_SRC_PCL_PROCESS}
# 		${PROJECT_SRC_BOUNDING_BOX}
# 		#${PROJECT_SRC_DIFF_HELPERS}
# 		#${PROJECT_SRC_PROJECTIONS}
# 		#${PROJECT_SRC_IMAGE_LABELERS}
# 		#${PROJECT_SRC_CLUSTERS}
# 		#${PROJECT_SRC_COMMUNICATION}
# 		)

# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})


# link_directories(${PCL_LIBRARY_DIRS})

# message("liblog dirs: ${LIBLOGDIR}")
# message("PCL_LIBRARY_DIRS: ${PCL_LIBRARY_DIRS}")
# message("PCL_LIBRARIES: ${PCL_LIBRARIES}")

# message("PCL_INCLUDE_DIRS ${PCL_INCLUDE_DIRS}")
# message("PCL_LIBRARIES: ${PCL_LIBRARY_DIRS}")
# add_definitions(${PCL_DEFINITIONS})

# If the package has been found, several variables will
# be set, you can find the full list with descriptions
# in the OpenCVConfig.cmake file.
# Print some message showing some of them
# message(STATUS "OpenCV library status:")
# message(STATUS "    version: ${OpenCV_VERSION}")
# message(STATUS "    libraries: ${OpenCV_LIBS}")
# message(STATUS "    include path: ${OpenCV_INCLUDE_DIRS}")


# target_link_libraries(${PROJECT_NAME}
#     ${catkin_LIBRARIES}
#     ${PCL_LIBRARIES}
#     ${OpenCV_LIBS} # 链接动态库
#     #log4cplus
#     #c_lidar_obj_util
# )

